﻿App.addNewPage({
	id: 'intro',
	url: '/Home/Intro',
	title: Localization.IntroTitle,
	require: [],
	init: function () {

		if (!App.user.isAuthorized()) {
			App.goToPage('logon');
			return;
		}

		$(window).bind('beforeunload', function () {
			return Localization.LogoutConfirmation;
		});

		$('#username').text(App.user.name);
		$('#avatar').css({ border: 'solid 5px ' + App.user.color });

		$('#start').click(function () {
			App.goToPage('game');
		}).focus();

		function initSlideShow() {
			$('#slideshow').bjqs({
				height: 500,
				width: 657,
				animtype: 'slide',
				animduration: 450,
				animspeed: 6000,
				nexttext: '<i class="uk-icon-chevron-right uk-icon-large bjqs-chevron"></i>',
				prevtext: '<i class="uk-icon-chevron-left uk-icon-large bjqs-chevron"></i>',
				centermarkers: false,
				randomstart: false,
				responsive: true // enable responsive capabilities (beta)
			});
		}
		if (!App.isUndefined($().bjqs)) {
			App.getScript('Scripts/bjqs.min.js', initSlideShow);
		} else {
			initSlideShow();
		}
	}
});